// Package models 数据表模型
package models

import "github.com/jinzhu/gorm"

/*
	create table test100 (
    -> id int(10) primary key auto_increment,
    -> name char(10) not null default 'name',
    -> age tinyint(1) not null default 18
    -> )engine=innodb default charset=utf8;
*/

// ITest100Reposity interface
type ITest100Reposity interface {
	Create(*Test100) error
}

// Test100 struct
type Test100 struct {
	ID   int64  `gorm:"column:id"`
	Name string `gorm:"column:name"`
	Age  int    `gorm:"column:age"`
}

// Test100Model struct
type Test100Model struct{}

func (repo Test100Model) db() *gorm.DB {
	return DB.Table("test100")
}

// Create func
func (repo Test100Model) Create(m *Test100) error {
	return repo.db().Create(m).Error
}
